//
//  LookAlreadyTaskTableViewCell.swift
//  BusinessIOS
//
//  Created by Rain on 2018/12/28.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class LookAlreadyTaskTableViewCell: UITableViewCell {
    
    var photoImagView:UIImageView!
    
    var nameLabel:UILabel!
    
    var statLabel:UILabel!
    
    var timeLabel:UILabel!
    
    
    
    var neirongLabel:UILabel!
    
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        
    }
    //    cell.alreadyTasksWithModel(model: cellModel)
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
        
    }
    
    // 赋值方法 - 显示 cell 内容方法
    func LookAlreadyTaskTableViewCell(model: LookAlreadyTaskModel) {
        
        
         nameLabel.text = model.assigneeName
        
         statLabel.text = model.taskName
        
        timeLabel.text = model.startTime
        
        neirongLabel.text = model.taskResult
        
        
        
    }
    func lauoutUI(){
        
        
        photoImagView = UIImageView(image: UIImage(named: "morentouxiang"))
     
        
        photoImagView.layer.cornerRadius = 20
        photoImagView.layer.masksToBounds = true
        self.contentView.addSubview(photoImagView)
        

        
        nameLabel = UILabel()

        nameLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        self.contentView.addSubview(self.nameLabel!)
        
        
        statLabel = UILabel()
    
        statLabel.textAlignment = .left
        statLabel.font = UIFont.systemFont(ofSize:12)//一般方法
  
        self.contentView.addSubview(self.statLabel!)
        
        timeLabel = UILabel()
        timeLabel.text = "12-11 08:47"
      
        timeLabel.textAlignment = .right
        
        timeLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        
        self.contentView.addSubview(self.timeLabel!)
        
        
        neirongLabel = UILabel()
    
        neirongLabel.textAlignment = .left
        
        neirongLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        
        self.contentView.addSubview(self.neirongLabel!)
        
        
        
        
        

        
        self.layoutView()
    }
    
    func layoutView() {
        
        self.photoImagView.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.left.equalTo(self.snp.left).offset(10)
            make.width.equalTo(40)
            make.height.equalTo(40)
        }
        
        
        self.nameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.left.equalTo(self.photoImagView.snp.right).offset(5)
            make.width.equalTo(50)
            make.height.equalTo(20)
        }
        
        self.statLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.left.equalTo(self.nameLabel.snp.right).offset(5)
            make.right.equalTo(self.snp.right).offset(-150)
            make.height.equalTo(20)
        }
        
        self.timeLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.right.equalTo(self.snp.right).offset(-10)
            make.width.equalTo(120)
            make.height.equalTo(20)
        }
        
        self.neirongLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.nameLabel.snp.bottom).offset(0)
            make.right.equalTo(self.snp.right).offset(-10)
            make.left.equalTo(self.photoImagView.snp.right).offset(5)
            make.height.equalTo(20)
        }
        
  


        
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
